package lc;

public class lc73 {
    public static void main(String[] args) {
        setZeroes(new int[][]{{0,1,2,0},{1,2,2,2},{1,1,1,1}});
    }
        public static void setZeroes(int[][] matrix) {
            boolean[] cow = new boolean[matrix.length];
            boolean[] row = new boolean[matrix[0].length];
            for(int i = 0; i < matrix.length; ++i){
                for(int j = 0; j < matrix[0].length; ++j){
                    if(matrix[i][j] == 0){
                        cow[i] = true;
                        row[j] = true;
                    }
                }
            }
            for(int i = 0; i < matrix.length; ++i){
                if(cow[i] == true){
                    for(int j = 0; j < matrix[0].length; ++j){
                        matrix[i][j] = 0;
                    }
                }
            }

            for(int j = 0; j < matrix[0].length; ++j){
                if(row[j] == true){
                    for(int i = 0; i < matrix.length; ++i){
                        matrix[i][j] = 0;
                    }
                }
            }

        }

}
